/*
package com.study.doc;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
import java.io.File;
import java.util.List;
public class DocxMerger {

    public static void mergeDocuments(List<String> inputPaths, String outputPath) throws Exception {
        // 创建新文档
        WordprocessingMLPackage merged = WordprocessingMLPackage.createPackage();
        MainDocumentPart mergedDocumentPart = merged.getMainDocumentPart();

        // 合并每个文档
        for (String inputPath : inputPaths) {
            WordprocessingMLPackage src = WordprocessingMLPackage.load(new File(inputPath));
            MainDocumentPart srcDocumentPart = src.getMainDocumentPart();

            // 将源文档内容添加到合并文档中
            mergedDocumentPart.getContent().addAll(
                    Docx4jUtils.deepCopy(srcDocumentPart.getContent(), merged)
            );

            // 添加分页符(可选)
            mergedDocumentPart.addParagraphOfText("").addRun().addBreak(BrType.PAGE);
        }

        // 保存合并后的文档
        merged.save(new File(outputPath));
    }
}
*/
